package com.example.admin.config;

import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class MyBatisPlusConfig {

    @Bean   // 配置 MyBatis Plus 拦截器，启用分页功能
    public MybatisPlusInterceptor mybatisPlusInterceptor() {        // 配置 MyBatis Plus 拦截器，启用分页功能
        // 创建 MybatisPlusInterceptor 实例
        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
        // 添加分页插件到 MybatisPlusInterceptor 中
        interceptor.addInnerInterceptor(new PaginationInnerInterceptor());
        // 返回 MybatisPlusInterceptor 实例
        return interceptor;
    }
}
